package com.cheetah.server.runner;

import com.cheetah.config.ServerConfig;
import com.cheetah.server.bootstrap.CheetahServerBootstrap;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

import java.util.concurrent.CompletableFuture;

@Component
public class ServerRunner implements CommandLineRunner {

    @Autowired
    private ServerConfig serverConfig;

    @Autowired
    private CheetahServerBootstrap cheetahServerBootstrap;

    @Override
    public void run(String... args) throws Exception {
        CompletableFuture.runAsync(() -> {
            cheetahServerBootstrap.start();
        });
    }
}
